package activator;

import library.service.LibraryService;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

import service.factory.MedicalLibraryServiceFactory;

public class MedicalLibraryImplementorActivator implements BundleActivator {
	private ServiceRegistration serviceRegistration = null;

	public void start(BundleContext bundleContext) throws Exception {
		System.out.println("Bundle Implementor START");

		serviceRegistration = bundleContext.registerService(
				LibraryService.class.getName(),
				new MedicalLibraryServiceFactory(),
				ServicePropertiesProvider.getServiceProperties());
	}

	public void stop(BundleContext bundleContext) throws Exception {
		System.out.println("Bundle Implementor STOP");

		if (serviceRegistration != null) {
			serviceRegistration.unregister();
			serviceRegistration = null;
		}
	}
}
